UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5+FSRGZyYSYJCzAiu+dC4U3zxAvRF6DTUsO+N9Ky1dY=' 
WHERE 
  key_id = 'e063f24dd601556b1e04c15c050e65a6355a3488f93c95705393345fe9b78466' 
  AND (
    token = '5+FSRGZyYSYJCzAiu+dC4U3zxAvRF6DTUsO+N9Ky1dY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022