UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xiiyoTrZP3kim8RgT7YMjHs+u0alBnmc5lGKc6kLv4c='
WHERE
key_id = 'd13f4a87969410987e1dd3e2965cf813c8b8d012cc25b1c09a9b54c8c8d7ab08'
AND (
token = 'xiiyoTrZP3kim8RgT7YMjHs+u0alBnmc5lGKc6kLv4c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)