UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'v58gW0JiwPE+oX4IawbLk/TcxSLVJjKiVkMOUBIT73s='
WHERE
key_id = '99fa7bea6192ceb50dc79e4672ff661fb5e77aa9c7f1b1733b986c0a1d29218c'
AND (
token = 'v58gW0JiwPE+oX4IawbLk/TcxSLVJjKiVkMOUBIT73s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)