UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xN8hUvjdKk/tsjRIohySInaAlqRwkO+WowItjL8R8Rs='
WHERE
key_id = '3c7d3c171be0de8e6ae99200d6fef57703f99f9e0d8aa8699f217c8b34e45b1b'
AND (
token = 'xN8hUvjdKk/tsjRIohySInaAlqRwkO+WowItjL8R8Rs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)