UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KWT4IMyhujWhHRN0OBVSXmdlzv2UF/G7sfxr7m+fxA4=' 
WHERE 
  key_id = 'be4d116538558bea3810a8d9e26eb68a34e2a093ab063d1381941095f4ec4af0' 
  AND (
    token = 'KWT4IMyhujWhHRN0OBVSXmdlzv2UF/G7sfxr7m+fxA4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035