UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aqUwXKXx4Wd5TpSU0MpC/NolXXRz3E4xes/GdXG4GhQ=' 
WHERE 
  key_id = '1f9f7308c8bffd16597917e7e9fa2f2688166980a91e72e16db490907ac52480' 
  AND (
    token = 'aqUwXKXx4Wd5TpSU0MpC/NolXXRz3E4xes/GdXG4GhQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042