UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BD45uoNrCh2+iVo+yf+P+nkjB3a/GvXxKp9LrEA6inc='
WHERE
key_id = '458552a363f0fe74e7e8ae4d6d59520a447ddf89f05770975afa1c5df0fe524b'
AND (
token = 'BD45uoNrCh2+iVo+yf+P+nkjB3a/GvXxKp9LrEA6inc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)