UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ug5Qq108pKFPISgTOtQsg38SqzECunYu29DC+1TjHWA=' 
WHERE 
  key_id = '6ea6ba53061179b46a261bf4b24192417f83d14b373609be768b21d28b67e4d1' 
  AND (
    token = 'Ug5Qq108pKFPISgTOtQsg38SqzECunYu29DC+1TjHWA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033