UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'eT7x+v8c0lyk2tfFWYEg5yEUySLGgbSI97KNKy8XP3c='
WHERE
key_id = 'ca54ac9670610d609ab50aee2ad20d25d28723d7b4c16843c68c14b528c249ac'
AND (
token = 'eT7x+v8c0lyk2tfFWYEg5yEUySLGgbSI97KNKy8XP3c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)