UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e7qXuDBMsZJKAaHiAD0ac1rjCKXNcynb+ucx7KUBGIc=' 
WHERE 
  key_id = '9c406a79d405b78cb3012066faeb7c2a39e3de722c979a917482c26b745d125b' 
  AND (
    token = 'e7qXuDBMsZJKAaHiAD0ac1rjCKXNcynb+ucx7KUBGIc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018