UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kT7qnpIV1xbsE60f3hktAaTpExC44qCK8ZNQlVX2fMU='
WHERE
key_id = '039e1a673dfd7280e5ea53b0b78e311c085f7d34aa7f1f53decedc747caf3c5a'
AND (
token = 'kT7qnpIV1xbsE60f3hktAaTpExC44qCK8ZNQlVX2fMU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)