UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zsNGOcIDYEz+G/RrHen4kjOTfooBqfNMP3hzy6rIKvw='
WHERE
key_id = 'ed1dbe047abf257fb77fb439c1c9cb04b6047e22e0d24b74e9f99839d1bc2307'
AND (
token = 'zsNGOcIDYEz+G/RrHen4kjOTfooBqfNMP3hzy6rIKvw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)