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