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