UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OClG4AxbF2eKBExfE8IZitnV+bAbhAmErqnm+ZIrFec=' 
WHERE 
  key_id = '3dfd0cf3cd7d0a82b5988fc6c5966daed4c742c76e85e8f11576e152f30d309c' 
  AND (
    token = 'OClG4AxbF2eKBExfE8IZitnV+bAbhAmErqnm+ZIrFec=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00064