UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'swNiwoAAt3xFIjMzonj3OKa1IM4E6oPQiLa8f4SXskU='
WHERE
key_id = 'cf8907a1f78aa985ddd7bc01a4aeda1ed082b5616890d41d5acde7984eff5396'
AND (
token = 'swNiwoAAt3xFIjMzonj3OKa1IM4E6oPQiLa8f4SXskU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)