UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xLqzob7PI7WzNuEYQdnLSJyCmq0ZcIKsOD59644oD6s='
WHERE
key_id = '76169c7017fb7648a6151ed598cd508752423e670931db4693b24ce79d38c2f9'
AND (
token = 'xLqzob7PI7WzNuEYQdnLSJyCmq0ZcIKsOD59644oD6s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)