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