UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1Fow7z3RgtjqAFW/dMsPKx7R3x5gsDSnNFTA1cWLzSU='
WHERE
key_id = 'fb5098525dccabf258927965813ff80c08ff903bc509322828a14aa9e4804687'
AND (
token = '1Fow7z3RgtjqAFW/dMsPKx7R3x5gsDSnNFTA1cWLzSU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)