UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KWYq2827SxIycExf355+17qmHPVWeEyVr/7JxcwUGSc=' 
WHERE 
  key_id = '64357b6c6c44ad399620a53826919012ca3acd7d6d66150fd87b0624b7806521' 
  AND (
    token = 'KWYq2827SxIycExf355+17qmHPVWeEyVr/7JxcwUGSc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028