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