UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BCFtqYdesRfZMcULuMXKXObbzC3OLW30fZrOlQ3GQN8='
WHERE
key_id = 'c6d01d4b7c71b65ead2e4834db65050607f8d1e02ba99f1c3ae623eadb6a13ea'
AND (
token = 'BCFtqYdesRfZMcULuMXKXObbzC3OLW30fZrOlQ3GQN8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)