UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QGRtnOMBaCVaeZnzn/sSLtfUWi1+WzTGFPnhVbgmRyk=' 
WHERE 
  key_id = '1f4cc587298f7c5c540740602739f58110b8f2330c50b5b820d8d7486865c94f' 
  AND (
    token = 'QGRtnOMBaCVaeZnzn/sSLtfUWi1+WzTGFPnhVbgmRyk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046