UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+C7dQ3c2KGHbfqDl9oCgW+4CoMfSRcsHFpm4nJNHeng='
WHERE
key_id = '1ea4f24f1f831b91f8cabc976e13524294835fdf9edfa3b93c9d766b10b093bc'
AND (
token = '+C7dQ3c2KGHbfqDl9oCgW+4CoMfSRcsHFpm4nJNHeng='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)