UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DdVpUP9LdldbsCJrpV44pv6I3Dqkxd1Er+UNA4FPhzU='
WHERE
key_id = 'ca954ba0860ff66793bcea227ed62e25a691aef6695d2df988c34e8e9907333c'
AND (
token = 'DdVpUP9LdldbsCJrpV44pv6I3Dqkxd1Er+UNA4FPhzU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)