UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ww+8iijNjRHsRKvDTzgdYtI5zYofxFnoAxPJCd++qzc='
WHERE
key_id = '6abeb5f879697074cc8ad2ff04f85d376f7abf00658c4b7c093a893fa90e787b'
AND (
token = 'ww+8iijNjRHsRKvDTzgdYtI5zYofxFnoAxPJCd++qzc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)