UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YZDxI3lzPrwJMOY0+oB9+FUeraBjzLyFdJqQ8mmo5W8=' 
WHERE 
  key_id = 'e9f93c515e6a89ec6f21397345141d78f6d04a200a4a7c1c2295685d43f2a77a' 
  AND (
    token = 'YZDxI3lzPrwJMOY0+oB9+FUeraBjzLyFdJqQ8mmo5W8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00060