UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YfCWJ8gmTvkzgYmT+6+wSbQqQlhmmgLcc2iTWLO8JGk='
WHERE
key_id = 'e7446f94baff0d98639d679201a8b33c958c7f2d606c628d32c5b70c843d464d'
AND (
token = 'YfCWJ8gmTvkzgYmT+6+wSbQqQlhmmgLcc2iTWLO8JGk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)