UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qKR5RVmwSG1yXeXDC2SrnoqPULXzxcbScRmWg+uzsbg=' 
WHERE 
  key_id = '6b93ca62db783db8ea32139057680e270f75a89e4227eb92f7dab4f759bdc493' 
  AND (
    token = 'qKR5RVmwSG1yXeXDC2SrnoqPULXzxcbScRmWg+uzsbg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036