UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GN+qHuRHrGYwBK+pENVD3KMLN/O+VT9zZ91jbLCrjd0=' 
WHERE 
  key_id = '41d80274f3328834f9c4b39f07f3a843a48eb3f28fe032933656b88e5cc36303' 
  AND (
    token = 'GN+qHuRHrGYwBK+pENVD3KMLN/O+VT9zZ91jbLCrjd0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00092