UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ivVAzNIfgk/5cqT09hsegTm13ImMONikyyOdkQKXLrA='
WHERE
key_id = '3f0c42916974dccc47d442fb2cf5dd712617a47fa7e97291e96ff82b08d72d4b'
AND (
token = 'ivVAzNIfgk/5cqT09hsegTm13ImMONikyyOdkQKXLrA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)