UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kvb04L+F3WXrUU3UqnABNQMPag7XZUZkmJcYOlhbK6A=' 
WHERE 
  key_id = '24bc0fd8fde6d3a57129df0aa14741bc015cbbda5e97110290f99bf749d49563' 
  AND (
    token = 'kvb04L+F3WXrUU3UqnABNQMPag7XZUZkmJcYOlhbK6A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042