UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9WVDTCJyHINrF0zzRWBdBn+w9juVvgVrrPpV87haBw4=' 
WHERE 
  key_id = 'fe37af44ab8692e27ce65ff50259a21f8b8af5e2c4d6b8c0f9dd4321d38453fb' 
  AND (
    token = '9WVDTCJyHINrF0zzRWBdBn+w9juVvgVrrPpV87haBw4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027